<?php ini_set("memory_limit","32M"); ?>
<link href="<?=base_url()?>asset/admin/css/style.css" rel="stylesheet" type="text/css">

<script type="text/javascript">
	function report_pdf(){		      
            var site = "<?php echo site_url()?>";
           /* $.ajax({
                url: site+"/laporan_pembelian/index",
                success: function(response){			
                $("#tab").html(response);
                },
            dataType:"html"  		
            });
            return false;*/
			var periode_awal=document.getElementById('tanggal_awal').value;
			var periode_akhir=document.getElementById('tanggal_akhir').value;
			  location.href = site+"/laporan_buku_kas/report_pdf/"+periode_awal+'/'+periode_akhir;
	}
	
	function report_excel(){
		document.getElementById("rekap_tabel1").value = document.getElementById("div_laporan").innerHTML;
		document.getElementById("myform").submit();
	}
	
	
	function print(){
		/*<form>
		<input type="button" value="Print This Page" onClick="window.print()" />
		</form>*/
	}
	
	
</script>
			<div id="tab-settings" class="tabs-content">
					<button type="button" onclick="report_pdf()"><img src="<?=base_url()?>asset/admin/images/icons/fugue/tick-circle.png" width="16" height="16">REKAP PDF</button>
					<button type="submit" onclick="report_excel()"><img src="<?=base_url()?>asset/admin/images/icons/fugue/tick-circle.png" width="16" height="16">REKAP EXCEL</button>
					
			</div>	
<?php
	$attributes = array('class' => 'formccs', 'id' => 'myform', 'name'=> 'myform');	
	echo form_open('laporan_buku_kas/report_excel', $attributes);
?>	
<div id="div_laporan">
	<input name="rekap_tabel1" id="rekap_tabel1" type="hidden" value="rekap_tabel1" />
	<input name="periode_awal" id="tanggal_awal" type="hidden" value="<?=$periode_awal;?>" />
	<input name="periode_akhir" id="tanggal_akhir" type="hidden" value="<?=$periode_akhir;?>" />
	
	<table class="laporan" width="90%" border="1" align="center">
		<tr><td colspan="5"  div align="center"><b>KEMENTRIAN KOMUNIKASI DAN INFORMATIKA</b></td></tr>		<tr><td colspan="5"  div align="center"><b>DIREKTORAT JENDERAL PENYELENGGARAAN POS DAN INFORMATIKA</b></td></tr>
		
		<tr><td colspan="5" div align="center"><b>BALAI PENYEDIA DAN PENGELOLA PEMBIAYAAN TELEKOMUNIKASI DAN INFORMATIKA</b><br/></td></tr>
		<tr><td colspan="5" div align="center"><b>TRIAL BALANCE</b></td></tr>
		<tr><td colspan="5" div align="center"><b>Per : <?php echo $this->fungsi->dateindo3('-',$periode_awal) . ' S/D ' .  $this->fungsi->dateindo3('-',$periode_akhir); ?></b></td></tr>		<tr><td colspan="5" div align="center">(Dalam Rupiah)</td></tr>						
		<!--<tr><td colspan="10"><b>TANGGAL CETAK : <?php /* echo $this->fungsi->dateindo3('-',date('Y-m-d')) */ ?></b></td></tr>-->		<table border="0" width="800" cellpadding="0" cellspacing="0" align="center">			<thead>				<tr>					<th class="table-header-repeat line-left minwidth-1"><a href="">AKUNID</a></th>					<th class="table-header-repeat line-left minwidth-1"><a href="">DEBET</a></th>										<th class="table-header-repeat line-left minwidth-1"><a href="">KREDIT</a></th>								<th class="table-header-repeat line-left minwidth-1"><a href="">AKUNID</a></th>								<th class="table-header-repeat line-left minwidth-1"><a href="">DEBET</a></th>								<th class="table-header-repeat line-left minwidth-1"><a href="">KREDIT</a></th>							<th class="table-header-repeat line-left minwidth-1"><a href="">AKUNID</a></th>								<th class="table-header-repeat line-left minwidth-1"><a href="">DEBET</a></th>								<th class="table-header-repeat line-left minwidth-1"><a href="">KREDIT</a></th>										</tr>			</thead>			<tbody>			<?php				$i=1;				foreach($results_kas->result() as $row) { ?>					<tr class="alternate-row">						<td align="left" valign="top"><?=$row->masterakun_akunid?> </td>						<td align="left" valign="top"><?=$row->awal_debet?> </td>						<td align="left" valign="top"><?=$row->awal_kredit;?> </td>						<td align="left" valign="top"><?=$row->masterakun_akunid?> </td>						<td align="left" valign="top"><?=$row->mutasi_debet?> </td>						<td align="right" valign="top"><?=$row->mutasi_kredit?> </td>						<td align="left" valign="top"><?=$row->masterakun_akunid?> </td>												<?php							$saldo_akhirdebet = $row->awal_debet-$row->mutasi_debet;							$saldo_akhirkredit = $row->awal_kredit-$row->mutasi_kredit;						?>												<td align="left" valign="top"><?=$saldo_akhirdebet;?> </td>						<td align="right" valign="top"><?=$saldo_akhirkredit?> </td>					</tr>								<?php 					$sum_awaldebet[] = $row->awal_debet;					$sum_awalkredit[] = $row->awal_kredit;										$sum_mutasidebet[] = $row->mutasi_debet;					$sum_mutasikredit[] = $row->mutasi_kredit;										$sum_saldo_akhirdebet[] = $saldo_akhirdebet;					$sum_saldo_akhirkredit[] = $saldo_akhirkredit;										$i++;				} ?>					<tr class="alternate-row">						<td >Jumlah</td>						<td align="right" ><?=array_sum($sum_awaldebet)?></td>						<td align="right" ><?=array_sum($sum_awalkredit)?></td>						<td >Jumlah</td>						<td align="right" ><?=array_sum($sum_mutasidebet)?></td>						<td align="right" ><?=array_sum($sum_mutasikredit)?></td>						<td >Jumlah</td>						<td align="right" ><?=array_sum($sum_saldo_akhirdebet)?></td>						<td align="right" ><?=array_sum($sum_saldo_akhirkredit)?></td>					</tr>					<tr class="alternate-row">						<td>Balance</td>						<td colspan="2" align="center"><?php echo array_sum($sum_awaldebet) - array_sum($sum_awalkredit);?></td>												<td colspan="3" align="center"><?php echo array_sum($sum_mutasidebet) - array_sum($sum_mutasikredit);?></td>						<td colspan="3" align="center"><?php echo array_sum($sum_awaldebet) - array_sum($sum_saldo_akhirkredit);?></td>					</tr>			</tbody>					</table>		
	</table>
</div>
</form>